package com.zlm.user.emp.controller;

import com.zlm.common.base.BaseController;
import com.zlm.common.constants.CodeConstants;
import com.zlm.common.dto.JsonResultDto;
import com.zlm.common.entity.UserTokenDO;
import com.zlm.user.emp.service.UserTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: duyufu
 * @Date: 2019/4/30 14:39
 */
@RestController
@RequestMapping(value = "/token")
public class UserTokenController extends BaseController {

    @Autowired
    private UserTokenService userTokenService;

    @GetMapping("/getLoginUser")
    public JsonResultDto getLoginUser(String token) {
        try {
            UserTokenDO userToken = userTokenService.getLoginUser(token);
            return success(userToken);
        } catch (Exception e) {
            e.printStackTrace();
            return fail(e.getMessage());
        }

    }
}
